import sgg from '../request/syt'

// 登录信息约束
export interface loginInfo {
  phone:string,
  password:string
}

// 登录成功返回的数据
export interface successLogin {
  phone:string
  password:string
  name:string,
  nickName:string,
  token:string
}

// 注册信息约束
export interface registerLimit {
  phone:string,
  password:string,
  code:string
}

// 获取用户信息数据得约束
export interface getUserInfo {
  name:string,
  nickName:string,
  loginName:string,
  headImg:string,
  id:number
}
export default{
  // 登录
  reqLogin(userInfo:loginInfo){
    return sgg.post<any,successLogin>('/user/passport/login',userInfo)
    
  },

  // 获取用户信息
  reqGetUserInfo(){
    return sgg.get<any,getUserInfo>('/user/passport/auth/getUserInfo')
  },

  // 注册
  reqRegister(registerInfo:registerLimit){
    return sgg.post<any,null>('/user/passport/register',registerInfo)
   },

  //  退出登录
  logout(){
    return sgg.get<any,null>('/user/passport/logout')
  },

  // 校验验证码
  passPost(phone:string){
    return sgg.get<any,string>(`/user/passport/sendCode/${phone}`)
  }

}  


